//
//  LRXUserModel.m
//  路人侠
//
//  Created by zhangxulong on 2/13/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXUserModel.h"

@implementation LRXUserModel
- (NSString *)description
{
    NSString * p = [NSString stringWithFormat:@"用户姓名：%@--用户照片：%@--用户邮箱：%@",self.userName,self.userImage,self.email];
    return p;
}

- (instancetype)initUserModelWithDic:(NSDictionary * )responseObject
{
    if (self = [super init]) {
        self.time = responseObject[@"time"];
        self.userName = responseObject[@"data"][@"username"];
        self.userImage = responseObject[@"data"][@"profile_url"];
        self.email = responseObject[@"data"][@"email"];
        self.sexy = responseObject[@"data"][@"sexy"];
        self.speed_rank = responseObject[@"data"][@"speed_rank"];
        self.manner_rank = responseObject[@"data"][@"manner_rank"];
        self.is_verify = responseObject[@"data"][@"is_verify"];
        self.role = responseObject[@"data"][@"role"];
    }
    return self;
}
+ (instancetype)userModelWithDic:(NSDictionary *)responseObject
{
    return [[LRXUserModel alloc]initUserModelWithDic:responseObject];
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    NSLog(@"正在归档。。。。。。。");
    [aCoder encodeObject:self.userName forKey:@"kUserName"];
    [aCoder encodeObject:self.userImage forKey:@"kUserImage"];
    [aCoder encodeObject:self.email forKey:@"kEmain"];
    [aCoder encodeObject:self.speed_rank forKey:@"kOnTimeRank"];
    [aCoder encodeObject:self.manner_rank forKey:@"kMannerRank"];
    [aCoder encodeObject:self.is_verify forKey:@"kIsVerify"];
    [aCoder encodeObject:self.sexy forKey:@"kSexy"];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{

    NSLog(@"正在解当。。。。。");
    
    if(self = [super init])
    {
        self.userName = [aDecoder decodeObjectForKey:@"kUserName"];
        self.userImage = [aDecoder decodeObjectForKey:@"kUserImage"];
        self.email = [aDecoder decodeObjectForKey:@"kEmain"];
        self.speed_rank = [aDecoder decodeObjectForKey:@"kOnTimeRank"];
        self.manner_rank = [aDecoder decodeObjectForKey:@"kMannerRank"];
        self.is_verify = [aDecoder decodeObjectForKey:@"kIsVerify"];
        self.sexy = [aDecoder decodeObjectForKey:@"kSexy"];
    }
   
    
    return self;
}

@end
